home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Games Collection 1 / software vault.zip / software vault / CDR10 / TGE129C.ZIP / SOURCE / TGE.H < prev    next >
C/C++ Source or Header  |  1993-08-20  |  25KB  |  434 lines

  1. /*****************************************************************************
  2. *       The Graphics Engine version 1.29ßC                                   *
  3. *                                                                            *
  4. *       The Graphics Engine code and documentation are Copyright (c) 1993    *
  5. *       by Matthew Hildebrand.                                               *
  6. *                                                                            *
  7. *       Unauthorised usage or modification of any or all of The Graphics     *
  8. *       Engine is strictly prohibited.                                       *
  9. *****************************************************************************/
  10.  
  11. #ifndef TGEdotH
  12. #define TGEdotH
  13.  
  14.  
  15. /* The basic structure used to store function pointers and mode data */
  16.  
  17. struct GraphDrv {
  18.   /* Non-I/O functions */
  19.   int far (*_initGraphics)(void);
  20.   void far (*_deInitGraphics)(void);
  21.   void far (*_setPaletteReg)(unsigned palReg, unsigned char red, unsigned char green, unsigned char blue);
  22.   void far (*_getPaletteReg)(unsigned palReg, unsigned char far *red, unsigned char far *green, unsigned char far *blue);
  23.   void far (*_setBlockPalette)(unsigned firstReg, unsigned lastReg, void far *data);
  24.   void far (*_getBlockPalette)(unsigned firstReg, unsigned lastReg, void far *data);
  25.   unsigned far (*_colourCloseTo)(unsigned char red, unsigned char green, unsigned char blue);
  26.   unsigned far (*_colourCloseToX)(unsigned char red, unsigned char green, unsigned char blue, unsigned colourExclude);
  27.   unsigned long far (*_imageSize)(int ulx, int uly, int lrx, int lry);
  28.   unsigned long far (*_imageSizeDim)(unsigned wide, unsigned deep);
  29.   void far (*_setPage)(unsigned pageNum);    /* not implemented yet */
  30.  
  31.   /* Currently active I/O functions */
  32.   void huge (*_getImage)(int ulx, int uly, int lrx, int lry, void far *image);
  33.   void far (*_getLine)(int lineNum, int xOff, int lineLen, void far *buf);
  34.   unsigned far (*_getPixel)(int x, int y);
  35.   void huge (*_putImage)(int x, int y, void far *image);
  36.   void huge (*_putImageInv)(int x, int y, void far *image);
  37.   void far (*_putLine)(int lineNum, int xOff, int lineLen, void far *buf);
  38.   void far (*_putLineInv)(int lineNum, int xOff, int lineLen, void far *buf);
  39.   void far (*_putPixel)(int x, int y, unsigned colour);
  40.   void far (*_line)(int x1, int y1, int x2, int y2, unsigned colour);
  41.   void far (*_horizLine)(int y, int x1, int x2, unsigned colour);
  42.   void far (*_vertLine)(int x, int y1, int y2, unsigned colour);
  43.   void far (*_drawRect)(int ulx, int uly, int lrx, int lry, unsigned colour);
  44.   void far (*_filledRect)(int ulx, int uly, int lrx, int lry, unsigned colour);
  45.   void far (*_clearGraphics)(unsigned colour);
  46.   void far (*_ellipse)(int xc, int yc, int wide, int deep, unsigned colour);
  47.   void far (*_filledEllipse)(int xc, int yc, int wide, int deep, unsigned colour);
  48.   void far (*_circle)(int x, int y, int radius, unsigned colour);
  49.   void far (*_filledCircle)(int x, int y, int radius, unsigned colour);
  50.   void far (*_fillRegion)(int x, int y, unsigned colour);
  51.   void far (*_fillLine)(int y, int x1, int x2, unsigned colour);
  52.  
  53.   /* Input functions */
  54.   void huge (*_getImage_scr)(int ulx, int uly, int lrx, int lry, void far *image);
  55.   void huge (*_getImage_mem)(int ulx, int uly, int lrx, int lry, void far *image);
  56.   void far (*_getLine_scr)(int lineNum, int xOff, int lineLen, void far *buf);
  57.   void far (*_getLine_mem)(int lineNum, int xOff, int lineLen, void far *buf);
  58.   unsigned far (*_getPixel_scr)(int x, int y);
  59.   unsigned far (*_getPixel_mem)(int x, int y);
  60.  
  61.   /* Output functions */
  62.   void huge (*_putImage_scr_copy)(int x, int y, void far *image);
  63.   void huge (*_putImage_scr_and) (int x, int y, void far *image);
  64.   void huge (*_putImage_scr_not) (int x, int y, void far *image);
  65.   void huge (*_putImage_scr_or)  (int x, int y, void far *image);
  66.   void huge (*_putImage_scr_xor) (int x, int y, void far *image);
  67.   void huge (*_putImage_mem_copy)(int x, int y, void far *image);
  68.   void huge (*_putImage_mem_and) (int x, int y, void far *image);
  69.   void huge (*_putImage_mem_not) (int x, int y, void far *image);
  70.   void huge (*_putImage_mem_or)  (int x, int y, void far *image);
  71.   void huge (*_putImage_mem_xor) (int x, int y, void far *image);
  72.   void huge (*_putImageInv_scr_copy)(int x, int y, void far *image);
  73.   void huge (*_putImageInv_scr_and) (int x, int y, void far *image);
  74.   void huge (*_putImageInv_scr_not) (int x, int y, void far *image);
  75.   void huge (*_putImageInv_scr_or)  (int x, int y, void far *image);
  76.   void huge (*_putImageInv_scr_xor) (int x, int y, void far *image);
  77.   void huge (*_putImageInv_mem_copy)(int x, int y, void far *image);
  78.   void huge (*_putImageInv_mem_and) (int x, int y, void far *image);
  79.   void huge (*_putImageInv_mem_not) (int x, int y, void far *image);
  80.   void huge (*_putImageInv_mem_or)  (int x, int y, void far *image);
  81.   void huge (*_putImageInv_mem_xor) (int x, int y, void far *image);
  82.   void far (*_putLine_scr_copy)(int lineNum, int xOff, int lineLen, void far *buf);
  83.   void far (*_putLine_scr_and) (int lineNum, int xOff, int lineLen, void far *buf);
  84.   void far (*_putLine_scr_not) (int lineNum, int xOff, int lineLen, void far *buf);
  85.   void far (*_putLine_scr_or)  (int lineNum, int xOff, int lineLen, void far *buf);
  86.   void far (*_putLine_scr_xor) (int lineNum, int xOff, int lineLen, void far *buf);
  87.   void far (*_putLine_mem_copy)(int lineNum, int xOff, int lineLen, void far *buf);
  88.   void far (*_putLine_mem_and) (int lineNum, int xOff, int lineLen, void far *buf);
  89.   void far (*_putLine_mem_not) (int lineNum, int xOff, int lineLen, void far *buf);
  90.   void far (*_putLine_mem_or)  (int lineNum, int xOff, int lineLen, void far *buf);
  91.   void far (*_putLine_mem_xor) (int lineNum, int xOff, int lineLen, void far *buf);
  92.   void far (*_putLineInv_scr_copy)(int lineNum, int xOff, int lineLen, void far *buf);
  93.   void far (*_putLineInv_scr_and) (int lineNum, int xOff, int lineLen, void far *buf);
  94.   void far (*_putLineInv_scr_not) (int lineNum, int xOff, int lineLen, void far *buf);
  95.   void far (*_putLineInv_scr_or)  (int lineNum, int xOff, int lineLen, void far *buf);
  96.   void far (*_putLineInv_scr_xor) (int lineNum, int xOff, int lineLen, void far *buf);
  97.   void far (*_putLineInv_mem_copy)(int lineNum, int xOff, int lineLen, void far *buf);
  98.   void far (*_putLineInv_mem_and) (int lineNum, int xOff, int lineLen, void far *buf);
  99.   void far (*_putLineInv_mem_not) (int lineNum, int xOff, int lineLen, void far *buf);
  100.   void far (*_putLineInv_mem_or)  (int lineNum, int xOff, int lineLen, void far *buf);
  101.   void far (*_putLineInv_mem_xor) (int lineNum, int xOff, int lineLen, void far *buf);
  102.   void far (*_putPixel_scr_copy)(int x, int y, unsigned colour);
  103.   void far (*_putPixel_scr_and) (int x, int y, unsigned colour);
  104.   void far (*_putPixel_scr_not) (int x, int y, unsigned colour);
  105.   void far (*_putPixel_scr_or)  (int x, int y, unsigned colour);
  106.   void far (*_putPixel_scr_xor) (int x, int y, unsigned colour);
  107.   void far (*_putPixel_mem_copy)(int x, int y, unsigned colour);
  108.   void far (*_putPixel_mem_and) (int x, int y, unsigned colour);
  109.   void far (*_putPixel_mem_not) (int x, int y, unsigned colour);
  110.   void far (*_putPixel_mem_or)  (int x, int y, unsigned colour);
  111.   void far (*_putPixel_mem_xor) (int x, int y, unsigned colour);
  112.   void far (*_line_scr_copy)(int x1, int y1, int x2, int y2, unsigned colour);
  113.   void far (*_line_scr_and) (int x1, int y1, int x2, int y2, unsigned colour);
  114.   void far (*_line_scr_not) (int x1, int y1, int x2, int y2, unsigned colour);
  115.   void far (*_line_scr_or)  (int x1, int y1, int x2, int y2, unsigned colour);
  116.   void far (*_line_scr_xor) (int x1, int y1, int x2, int y2, unsigned colour);
  117.   void far (*_line_mem_copy)(int x1, int y1, int x2, int y2, unsigned colour);
  118.   void far (*_line_mem_and) (int x1, int y1, int x2, int y2, unsigned colour);
  119.   void far (*_line_mem_not) (int x1, int y1, int x2, int y2, unsigned colour);
  120.   void far (*_line_mem_or)  (int x1, int y1, int x2, int y2, unsigned colour);
  121.   void far (*_line_mem_xor) (int x1, int y1, int x2, int y2, unsigned colour);
  122.   void far (*_horizLine_scr_copy)(int y, int x1, int x2, unsigned colour);
  123.   void far (*_horizLine_scr_and) (int y, int x1, int x2, unsigned colour);
  124.   void far (*_horizLine_scr_not) (int y, int x1, int x2, unsigned colour);
  125.   void far (*_horizLine_scr_or)  (int y, int x1, int x2, unsigned colour);
  126.   void far (*_horizLine_scr_xor) (int y, int x1, int x2, unsigned colour);
  127.   void far (*_horizLine_mem_copy)(int y, int x1, int x2, unsigned colour);
  128.   void far (*_horizLine_mem_and) (int y, int x1, int x2, unsigned colour);
  129.   void far (*_horizLine_mem_not) (int y, int x1, int x2, unsigned colour);
  130.   void far (*_horizLine_mem_or)  (int y, int x1, int x2, unsigned colour);
  131.   void far (*_horizLine_mem_xor) (int y, int x1, int x2, unsigned colour);
  132.   void far (*_vertLine_scr_copy)(int x, int y1, int y2, unsigned colour);
  133.   void far (*_vertLine_scr_and) (int x, int y1, int y2, unsigned colour);
  134.   void far (*_vertLine_scr_not) (int x, int y1, int y2, unsigned colour);
  135.   void far (*_vertLine_scr_or)  (int x, int y1, int y2, unsigned colour);
  136.   void far (*_vertLine_scr_xor) (int x, int y1, int y2, unsigned colour);
  137.   void far (*_vertLine_mem_copy)(int x, int y1, int y2, unsigned colour);
  138.   void far (*_vertLine_mem_and) (int x, int y1, int y2, unsigned colour);
  139.   void far (*_vertLine_mem_not) (int x, int y1, int y2, unsigned colour);
  140.   void far (*_vertLine_mem_or)  (int x, int y1, int y2, unsigned colour);
  141.   void far (*_vertLine_mem_xor)(int x, int y1, int y2, unsigned colour);
  142.   void far (*_drawRect_scr_copy)(int ulx, int uly, int lrx, int lry, unsigned colour);
  143.   void far (*_drawRect_scr_and) (int ulx, int uly, int lrx, int lry, unsigned colour);
  144.   void far (*_drawRect_scr_not) (int ulx, int uly, int lrx, int lry, unsigned colour);
  145.   void far (*_drawRect_scr_or)  (int ulx, int uly, int lrx, int lry, unsigned colour);
  146.   void far (*_drawRect_scr_xor) (int ulx, int uly, int lrx, int lry, unsigned colour);
  147.   void far (*_drawRect_mem_copy)(int ulx, int uly, int lrx, int lry, unsigned colour);
  148.   void far (*_drawRect_mem_and) (int ulx, int uly, int lrx, int lry, unsigned colour);
  149.   void far (*_drawRect_mem_not) (int ulx, int uly, int lrx, int lry, unsigned colour);
  150.   void far (*_drawRect_mem_or)  (int ulx, int uly, int lrx, int lry, unsigned colour);
  151.   void far (*_drawRect_mem_xor) (int ulx, int uly, int lrx, int lry, unsigned colour);
  152.   void far (*_filledRect_scr_copy)(int ulx, int uly, int lrx, int lry, unsigned colour);
  153.   void far (*_filledRect_scr_and) (int ulx, int uly, int lrx, int lry, unsigned colour);
  154.   void far (*_filledRect_scr_not) (int ulx, int uly, int lrx, int lry, unsigned colour);
  155.   void far (*_filledRect_scr_or)  (int ulx, int uly, int lrx, int lry, unsigned colour);
  156.   void far (*_filledRect_scr_xor) (int ulx, int uly, int lrx, int lry, unsigned colour);
  157.   void far (*_filledRect_mem_copy)(int ulx, int uly, int lrx, int lry, unsigned colour);
  158.   void far (*_filledRect_mem_and) (int ulx, int uly, int lrx, int lry, unsigned colour);
  159.   void far (*_filledRect_mem_not) (int ulx, int uly, int lrx, int lry, unsigned colour);
  160.   void far (*_filledRect_mem_or)  (int ulx, int uly, int lrx, int lry, unsigned colour);
  161.   void far (*_filledRect_mem_xor) (int ulx, int uly, int lrx, int lry, unsigned colour);
  162.   void far (*_clearGraphics_scr_copy)(unsigned colour);
  163.   void far (*_clearGraphics_scr_and) (unsigned colour);
  164.   void far (*_clearGraphics_scr_not) (unsigned colour);
  165.   void far (*_clearGraphics_scr_or)  (unsigned colour);
  166.   void far (*_clearGraphics_scr_xor) (unsigned colour);
  167.   void far (*_clearGraphics_mem_copy)(unsigned colour);
  168.   void far (*_clearGraphics_mem_and) (unsigned colour);
  169.   void far (*_clearGraphics_mem_not) (unsigned colour);
  170.   void far (*_clearGraphics_mem_or)  (unsigned colour);
  171.   void far (*_clearGraphics_mem_xor) (unsigned colour);
  172.   void far (*_ellipse_scr_copy)(int xc, int yc, int wide, int deep, unsigned colour);
  173.   void far (*_ellipse_scr_and) (int xc, int yc, int wide, int deep, unsigned colour);
  174.   void far (*_ellipse_scr_not) (int xc, int yc, int wide, int deep, unsigned colour);
  175.   void far (*_ellipse_scr_or)  (int xc, int yc, int wide, int deep, unsigned colour);
  176.   void far (*_ellipse_scr_xor) (int xc, int yc, int wide, int deep, unsigned colour);
  177.   void far (*_ellipse_mem_copy)(int xc, int yc, int wide, int deep, unsigned colour);
  178.   void far (*_ellipse_mem_and) (int xc, int yc, int wide, int deep, unsigned colour);
  179.   void far (*_ellipse_mem_not) (int xc, int yc, int wide, int deep, unsigned colour);
  180.   void far (*_ellipse_mem_or)  (int xc, int yc, int wide, int deep, unsigned colour);
  181.   void far (*_ellipse_mem_xor) (int xc, int yc, int wide, int deep, unsigned colour);
  182.   void far (*_filledEllipse_scr_copy)(int xc, int yc, int wide, int deep, unsigned colour);
  183.   void far (*_filledEllipse_scr_and) (int xc, int yc, int wide, int deep, unsigned colour);
  184.   void far (*_filledEllipse_scr_not) (int xc, int yc, int wide, int deep, unsigned colour);
  185.   void far (*_filledEllipse_scr_or)  (int xc, int yc, int wide, int deep, unsigned colour);
  186.   void far (*_filledEllipse_scr_xor) (int xc, int yc, int wide, int deep, unsigned colour);
  187.   void far (*_filledEllipse_mem_copy)(int xc, int yc, int wide, int deep, unsigned colour);
  188.   void far (*_filledEllipse_mem_and) (int xc, int yc, int wide, int deep, unsigned colour);
  189.   void far (*_filledEllipse_mem_not) (int xc, int yc, int wide, int deep, unsigned colour);
  190.   void far (*_filledEllipse_mem_or)  (int xc, int yc, int wide, int deep, unsigned colour);
  191.   void far (*_filledEllipse_mem_xor) (int xc, int yc, int wide, int deep, unsigned colour);
  192.   void far (*_circle_scr_copy)(int x, int y, int radius, unsigned colour);
  193.   void far (*_circle_scr_and) (int x, int y, int radius, unsigned colour);
  194.   void far (*_circle_scr_not) (int x, int y, int radius, unsigned colour);
  195.   void far (*_circle_scr_or)  (int x, int y, int radius, unsigned colour);
  196.   void far (*_circle_scr_xor) (int x, int y, int radius, unsigned colour);
  197.   void far (*_circle_mem_copy)(int x, int y, int radius, unsigned colour);
  198.   void far (*_circle_mem_and) (int x, int y, int radius, unsigned colour);
  199.   void far (*_circle_mem_not) (int x, int y, int radius, unsigned colour);
  200.   void far (*_circle_mem_or)  (int x, int y, int radius, unsigned colour);
  201.   void far (*_circle_mem_xor) (int x, int y, int radius, unsigned colour);
  202.   void far (*_filledCircle_scr_copy)(int x, int y, int radius, unsigned colour);
  203.   void far (*_filledCircle_scr_and) (int x, int y, int radius, unsigned colour);
  204.   void far (*_filledCircle_scr_not) (int x, int y, int radius, unsigned colour);
  205.   void far (*_filledCircle_scr_or)  (int x, int y, int radius, unsigned colour);
  206.   void far (*_filledCircle_scr_xor) (int x, int y, int radius, unsigned colour);
  207.   void far (*_filledCircle_mem_copy)(int x, int y, int radius, unsigned colour);
  208.   void far (*_filledCircle_mem_and) (int x, int y, int radius, unsigned colour);
  209.   void far (*_filledCircle_mem_not) (int x, int y, int radius, unsigned colour);
  210.   void far (*_filledCircle_mem_or)  (int x, int y, int radius, unsigned colour);
  211.   void far (*_filledCircle_mem_xor) (int x, int y, int radius, unsigned colour);
  212.   void far (*_fillRegion_scr_copy)(int x, int y, unsigned colour);
  213.   void far (*_fillRegion_scr_and) (int x, int y, unsigned colour);
  214.   void far (*_fillRegion_scr_not) (int x, int y, unsigned colour);
  215.   void far (*_fillRegion_scr_or)  (int x, int y, unsigned colour);
  216.   void far (*_fillRegion_scr_xor) (int x, int y, unsigned colour);
  217.   void far (*_fillRegion_mem_copy)(int x, int y, unsigned colour);
  218.   void far (*_fillRegion_mem_and) (int x, int y, unsigned colour);
  219.   void far (*_fillRegion_mem_not) (int x, int y, unsigned colour);
  220.   void far (*_fillRegion_mem_or)  (int x, int y, unsigned colour);
  221.   void far (*_fillRegion_mem_xor) (int x, int y, unsigned colour);
  222.   void far (*_fillLine_scr_copy)(int y, int x1, int x2, unsigned colour);
  223.   void far (*_fillLine_scr_and) (int y, int x1, int x2, unsigned colour);
  224.   void far (*_fillLine_scr_not) (int y, int x1, int x2, unsigned colour);
  225.   void far (*_fillLine_scr_or)  (int y, int x1, int x2, unsigned colour);
  226.   void far (*_fillLine_scr_xor) (int y, int x1, int x2, unsigned colour);
  227.   void far (*_fillLine_mem_copy)(int y, int x1, int x2, unsigned colour);
  228.   void far (*_fillLine_mem_and) (int y, int x1, int x2, unsigned colour);
  229.   void far (*_fillLine_mem_not) (int y, int x1, int x2, unsigned colour);
  230.   void far (*_fillLine_mem_or)  (int y, int x1, int x2, unsigned colour);
  231.   void far (*_fillLine_mem_xor) (int y, int x1, int x2, unsigned colour);
  232.  
  233.   /* Driver data */
  234.   int scrnMaxX, scrnMaxY;        /* physical screen dimensions */
  235.   unsigned maxColour;            /* maximum colour number */
  236.   unsigned xRatio, yRatio;        /* screen aspect ratio */
  237.   unsigned bitsPerPixel;        /* bits per pixel */
  238.   int inMaxX, inMaxY;            /* input screen dimensions */
  239.   int outMaxX, outMaxY;            /* output screen dimensions */
  240.   unsigned inScreenWide, outScreenWide;    /* needed for virtual screens */
  241.   int inViewportULX, inViewportULY;    /* input viewport coords */
  242.   int inViewportLRX, inViewportLRY;
  243.   int outViewportULX, outViewportULY;    /* output viewport coords */
  244.   int outViewportLRX, outViewportLRY;
  245.   unsigned pagingSupported;        /* not implemented yet */
  246.   unsigned curPage, maxPage;        /* not implemented yet */
  247.   unsigned imageWideAdjust;        /* not implemented yet */
  248.   void far *inAddr;            /* current input address */
  249.   void far *outAddr;            /* current output address */
  250.   void far *scrAddr;            /* screen address */
  251. };
  252.  
  253.  
  254. /* Note that this C/C++ bit might not work properly with your compiler.  If
  255.    you are using C++ and your linker reports that these functions are not
  256.    found, try explicitly forcing the extern "C" syntax by removing these
  257.    preprocessor directives. */
  258.  
  259. #ifdef __cplusplus
  260. extern "C" {
  261. #endif
  262.  
  263. /* load/unload routines */
  264. int TGE_loadGraphDriver(char *filename);
  265. void TGE_unloadGraphDriver(void);
  266.  
  267. /* virtual/real screen routines */
  268. void TGE_setGraphicsInputAddr(void far *addr);
  269. void TGE_setGraphicsOutputAddr(void far *addr);
  270. void TGE_setGraphicsAddr(void far *addr);
  271. void far *TGE_getGraphicsInputAddr(void);
  272. void far *TGE_getGraphicsOutputAddr(void);
  273. void far *TGE_makeVirtScreen(unsigned wide, unsigned deep);
  274.  
  275. /* output mode control routine */
  276. void TGE_setOutputMode(int mode);
  277.  
  278. /* viewport routines */
  279. void TGE_setInputViewport(int ulx, int uly, int lrx, int lry);
  280. void TGE_setOutputViewport(int ulx, int uly, int lrx, int lry);
  281. void TGE_setViewports(int ulx, int uly, int lrx, int lry);
  282. void TGE_getInputViewport(int far *ulx, int far *uly, int far *lrx, int far *lry);
  283. void TGE_getOutputViewport(int far *ulx, int far *uly, int far *lrx, int far *lry);
  284.  
  285. /* clipping routines */
  286. int TGE_clipLine(int *x1, int *y1, int *x2, int *y2);
  287. int TGE_clipFilledRect(int *ulx, int *uly, int *lrx, int *lry);
  288.  
  289. /* scale bitmap */
  290. void scaleBitmap(void *srcImage, unsigned newWide, unsigned newDeep,
  291.     void *destImage);
  292.  
  293. #ifdef __cplusplus
  294. };
  295. #endif
  296.  
  297.  
  298. /* Declare the structure used by the system so that programs can access it. */
  299.  
  300. extern struct GraphDrv far *TGEsys;
  301.  
  302.  
  303. /* The function names of TGE's functions are defined here.  Since they
  304.    are really just macros pretending to be functions, you can easily
  305.    change their names here if you don't like the default ones. */
  306.  
  307. #define initGraphics        (TGEsys->_initGraphics)
  308. #define deInitGraphics        (TGEsys->_deInitGraphics)
  309. #define putImage        (TGEsys->_putImage)
  310. #define putImageInv        (TGEsys->_putImageInv)
  311. #define getImage        (TGEsys->_getImage)
  312. #define putLine            (TGEsys->_putLine)
  313. #define putLineInv        (TGEsys->_putLineInv)
  314. #define getLine            (TGEsys->_getLine)
  315. #define imageSize        (TGEsys->_imageSize)
  316. #define imageSizeDim        (TGEsys->_imageSizeDim)
  317. #define putPixel        (TGEsys->_putPixel)
  318. #define getPixel        (TGEsys->_getPixel)
  319. #define line            (TGEsys->_line)
  320. #define horizLine        (TGEsys->_horizLine)
  321. #define vertLine        (TGEsys->_vertLine)
  322. #define drawRect        (TGEsys->_drawRect)
  323. #define filledRect        (TGEsys->_filledRect)
  324. #define setPaletteReg        (TGEsys->_setPaletteReg)
  325. #define getPaletteReg        (TGEsys->_getPaletteReg)
  326. #define setBlockPalette        (TGEsys->_setBlockPalette)
  327. #define getBlockPalette        (TGEsys->_getBlockPalette)
  328. #define clearGraphics        (TGEsys->_clearGraphics)
  329. #define ellipse            (TGEsys->_ellipse)
  330. #define filledEllipse        (TGEsys->_filledEllipse)
  331. #define circle            (TGEsys->_circle)
  332. #define filledCircle        (TGEsys->_filledCircle)
  333. #define fillRegion        (TGEsys->_fillRegion)
  334. #define colourCloseTo        (TGEsys->_colourCloseTo)
  335. #define colourCloseToX        (TGEsys->_colourCloseToX)
  336. #define fillLine        (TGEsys->_fillLine)
  337.  
  338. #define loadGraphDriver        TGE_loadGraphDriver
  339. #define unloadGraphDriver    TGE_unloadGraphDriver
  340.  
  341. #define setGraphicsOutputAddr    TGE_setGraphicsOutputAddr /* set outputs */
  342. #define setGraphicsInputAddr    TGE_setGraphicsInputAddr  /* set input   */
  343. #define setGraphicsAddr        TGE_setGraphicsAddr      /* set I/O     */
  344. #define makeVirtScreen        TGE_makeVirtScreen      /* make virtual screen */
  345. #define getGraphicsOutputAddr    TGE_getGraphicsOutputAddr /* set output  */
  346. #define getGraphicsInputAddr    TGE_getGraphicsInputAddr  /* set input   */
  347.  
  348. #define setOutputMode        TGE_setOutputMode      /* output mode */
  349.  
  350. #define setOutputViewport    TGE_setOutputViewport      /* viewports */
  351. #define setInputViewport           TGE_setInputViewport
  352. #define setViewports            TGE_setViewports
  353. #define setViewport        TGE_setViewports
  354. #define getOutputViewport    TGE_getOutputViewport
  355. #define getInputViewport          TGE_getInputViewport
  356. #define getViewport        TGE_getOutputViewport
  357.  
  358. #define clipLine        TGE_clipLine          /* clipping */
  359. #define clipFilledRect        TGE_clipFilledRect
  360. #define clipPoint(x,y)        TGE_clipPoint(x,y)
  361. #define pointOnScreen(x,y)    TGE_pointOnScreen(x,y)
  362.  
  363.  
  364. /* These macros provide easy access to important mode information in the
  365.    TGE system structure. */
  366.  
  367. #define INMAXX            (TGEsys->inMaxX)
  368. #define INMAXY            (TGEsys->inMaxY)
  369. #define OUTMAXX            (TGEsys->outMaxX)
  370. #define OUTMAXY            (TGEsys->outMaxY)
  371. #define MAXCOLOUR        (TGEsys->maxColour)
  372. #define XRATIO            (TGEsys->xRatio)
  373. #define YRATIO            (TGEsys->yRatio)
  374. #define INVIEWPORTULX        (TGEsys->inViewportULX)
  375. #define INVIEWPORTULY        (TGEsys->inViewportULY)
  376. #define INVIEWPORTLRX        (TGEsys->inViewportLRX)
  377. #define INVIEWPORTLRY        (TGEsys->inViewportLRY)
  378. #define OUTVIEWPORTULX        (TGEsys->outViewportULX)
  379. #define OUTVIEWPORTULY        (TGEsys->outViewportULY)
  380. #define OUTVIEWPORTLRX        (TGEsys->outViewportLRX)
  381. #define OUTVIEWPORTLRY        (TGEsys->outViewportLRY)
  382. #define SCREENMAXX        (TGEsys->scrnMaxX)
  383. #define SCREENMAXY        (TGEsys->scrnMaxY)
  384. #define MAXX            (TGEsys->outMaxX)
  385. #define MAXY            (TGEsys->outMaxY)
  386. #define VIEWPORTULX        (TGEsys->outViewportULX)
  387. #define VIEWPORTULY        (TGEsys->outViewportULY)
  388. #define VIEWPORTLRX        (TGEsys->outViewportLRX)
  389. #define VIEWPORTLRY        (TGEsys->outViewportLRY)
  390.  
  391.  
  392. /* These macros are for the various output modes */
  393.  
  394. #define TGE_COPY_PUT    0
  395. #define TGE_AND_PUT    1
  396. #define TGE_NOT_PUT    2
  397. #define TGE_OR_PUT    3
  398. #define TGE_XOR_PUT    4
  399.  
  400.  
  401. /* These macros are standard with Borland C/C++ compilers; this bit defines
  402.    them if you're using a non-Borland compiler. */
  403.  
  404. #if !defined(__TURBOC__) && !defined(__BORLANDC__)
  405.   #define MK_FP(seg,ofs)    ((void _seg *)(seg)+(void near *)(ofs))
  406.   #define FP_SEG(fp)        ((unsigned)(void _seg *)(void far *)(fp))
  407.   #define FP_OFF(fp)        ((unsigned)(fp))
  408. #endif
  409.  
  410.  
  411. /* These macros are the return codes from loadGraphDriver() */
  412.  
  413. #define TGE_SUCCESS     0        /* driver loaded successfully */
  414. #define TGE_OPEN_ERR    -1        /* error opening given file */
  415. #define TGE_FORMAT_ERR    -2        /* file is not a TGE driver */
  416. #define TGE_ALLOC_ERR    -3            /* error allocating memory */
  417. #define TGE_FILE_ERR    -4        /* file I/O error */
  418.  
  419.  
  420. /******
  421. ******* Point clipping routines
  422. ******/
  423.  
  424. /* Return true if a point is on the output screen, or 0 if it isn't */
  425. #define TGE_pointOnScreen(x,y) \
  426.   ((x>=0) && (x<=OUTMAXX) && (y>=0) && (y<=OUTMAXY))
  427.  
  428. /* Return true if a point is within the current output viewport, or
  429.    0 if it isn't */
  430. #define TGE_clipPoint(x,y) \
  431.   ((x>=OUTVIEWPORTULX) && (x<=OUTVIEWPORTLRX) && \
  432.    (y>=OUTVIEWPORTULY) && (y<=OUTVIEWPORTLRY))
  433.  
  434. #endif